<template>
	<view class="container">
		<view class="banner">
			<u-image src="https://cdn.uviewui.com/uview/swiper/swiper2.png" show-loading width="100%"
				height="326rpx"></u-image>
			<view class="back-box" @click="goBack"><u-icon name="arrow-left" color="#fff" size="36"></u-icon></view>
		</view>
		<view class="main _card">
			<view class="info">
				<view class="name u-line-2">這是早餐</view>
				<view class="brief u-line-3">這是一段分類簡介、這是一段分類簡介、這是一段...這是一段分類簡介、這是一段分類簡介、這是一段...這是一段分類簡介、這是一段分類簡介、這是一段...</view>
			</view>
			<u-image class="pic" src="https://cdn.uviewui.com/uview/swiper/swiper1.png" show-loading radius="16rpx"
				width="168rpx" height="168rpx"></u-image>
		</view>
		<view class="category _card">
			<u-tabs :list="categorys" line-color="#033787" line-height="6" line-width="24" :active-style="{color: '#033787'}"
				@click="clickCategory"></u-tabs>
		</view>
		<view class="list">
			<view v-for="(item, index) in goodsList" :key="index" class="item _card" @click="goodsInfo(item.id)">
				<u-image :src="item.pic" radius="16rpx" show-loading width="208rpx" height="208rpx"></u-image>
				<view class="info">
					<view class="name u-line-1">{{item.name}}</view>
					<view class="parameter">
						{{$t('goods.sales')}}: {{item.sales}}
						<text style="margin-left: 24rpx;">{{$t('goods.energy')}}: {{item.energy}}</text>
					</view>
					<view class="tags">
						<view v-for="(tag, index) in item.tags" :key="index" class="tag">{{tag}}</view>
					</view>
					<view class="price-box">
						<view class="price">
							<text class="symbol">$</text>{{item.price}}
						</view>
						<num-box type="" />
					</view>
				</view>
			</view>
		</view>
		<buy-car />
	</view>
</template>

<script>
	import buyCar from './buy-car.vue'
	import numBox from './num-box.vue'
	export default {
		components: {
			buyCar,
			numBox
		},
		data() {
			return {
				categorys: [{
						id: 1,
						name: '拌饭'
					},
					{
						id: 1,
						name: '拌饭'
					},
					{
						id: 1,
						name: '拌饭'
					},
					{
						id: 1,
						name: '拌饭'
					},
					{
						id: 1,
						name: '拌饭'
					},
					{
						id: 1,
						name: '拌饭'
					},
					{
						id: 1,
						name: '拌饭'
					},
					{
						id: 1,
						name: '拌饭'
					},
					{
						id: 1,
						name: '拌饭'
					},
					{
						id: 1,
						name: '拌饭'
					},
					{
						id: 1,
						name: '拌饭'
					},
					{
						id: 1,
						name: '拌饭'
					},
					{
						id: 1,
						name: '拌饭'
					},
					{
						id: 1,
						name: '拌饭'
					},
					{
						id: 1,
						name: '拌饭'
					},
					{
						id: 1,
						name: '拌饭'
					},
					{
						id: 1,
						name: '拌饭'
					},
				],
				goodsList: [{
						id: 1,
						pic: 'https://cdn.uviewui.com/uview/swiper/swiper2.png',
						name: '這是早餐',
						sales: 88,
						energy: 108,
						tags: ['好吃', '配送快'],
						price: 10.86
					},
					{
						id: 2,
						pic: 'https://cdn.uviewui.com/uview/swiper/swiper1.png',
						name: '這是午餐',
						sales: 88,
						energy: 108,
						tags: ['肥牛不错'],
						price: 10.86
					},
				]
			}
		},
		onShow() {

		},
		methods: {
			clickCategory() {

			},
			goBack() {
				uni.navigateBack()
			},
			goodsInfo(id) {
				uni.navigateTo({
					url: '/pages/store/goods?id=' + id
				})
			}
		}
	}
</script>

<style lang="scss">
	.back-box {
		background: rgba(0, 0, 0, 0.3);
		position: fixed;
		top: 48rpx;
		left: 32rpx;
		border-radius: 32rpx;
		height: 48rpx;
		width: 48rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.banner {
		height: 326rpx;
		z-index: 1;
		position: relative;
	}

	.main {
		margin-top: -100rpx;
		height: 148rpx;
		z-index: 2;
		position: relative;
		display: flex;
		justify-content: space-between;

		.info {
			justify-content: space-between;
			padding-right: 32rpx;
			overflow: hidden;

			.name {
				font-weight: 600;
				font-size: 30rpx;
				color: #0C1626;
			}

			.brief {
				margin-top: 12rpx;
				color: #7C8493;
				font-size: 22rpx;
			}
		}

		.pic {
			position: relative;
			right: 0rpx;
			top: -60rpx
		}
	}

	.category {
		margin: 24rpx;
		padding: 8rpx;
		padding-bottom: 12rpx;
	}

	.list {
		padding-bottom: 24rpx;

		.item {
			margin-bottom: 24rpx;
			display: flex;
			height: 208rpx;

			.info {
				width: calc(100% - 108rpx);
				margin-left: 24rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-between;

				.name {
					font-size: 30rpx;
					color: #0C1626;
					font-weight: 600;
				}

				.parameter {
					font-size: 22rpx;
					color: #B9BFCB;
				}

				.tags {
					display: flex;

					.tag {
						font-size: 18rpx;
						border-radius: 4rpx;
						padding: 2rpx 6rpx;
						color: #fff;
						margin-right: 8rpx;
						background-color: #E35525;
					}
				}

				.price-box {
					height: 68rpx;
					display: flex;
					justify-content: space-between;
					align-items: flex-end;

					.price {
						color: #E35525;
						font-size: 30rpx;

						.symbol {
							font-size: 16rpx;
						}
					}
				}
			}
		}
	}
</style>